package com.zty.xiaomi.server.Mapper;

import com.zty.xiaomi.server.Entity.Service.ServiceOrder;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

@Component
public interface ServiceOrderMapper {
    @Insert("insert into service_order(orderNo,good_id,store_id,service_id,insurance_name,refund_amount,service_reason," +
            "service_way,express,returnAddress,instructions,instructions_img,status,store_reply,good_status)" +
            " values(#{orderNo},#{good_id},#{store_id},#{service_id},#{insurance_name},#{refund_amount},#{service_reason}," +
            "#{service_way},#{express},#{returnAddress},#{instructions},#{instructions_img},#{status}," +
            "#{store_reply}, #{good_status})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int addServiceOrder(ServiceOrder serviceOrder);

    @Select("select id,orderNo,good_id,service_id,insurance_name,refund_amount,service_reason,service_way," +
            "express,returnAddress,instructions,instructions_img,status,store_reply,good_status from service_order" +
            " where orderNo = #{orderNo} and good_id = #{good_id}")
    ServiceOrder getServiceOrderDetailByOrderNoAndGoodId(int orderNo, int good_id);
}
